<script>
	import config from '@/admin.config.js'
	export default {
		computed: {},
		methods: {},
		onPageNotFound(msg) {
			uni.redirectTo({
				url: config.error.url
			})
		},
		onLaunch: function() {
			let globalData = this.$options.globalData;
			console.log('App Launch')
			if (!globalData.isTokenValid) {
				uni.navigateTo({
					url: config.login.url
				})
			} else {
				globalData.init()
			}
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		globalData: {
			isTokenValid: true,
			init() {
				// 更改值
				let that = this;
				that.isTokenValid = true;
				uni.navigateTo({
					url: '/'
				})
			},
		}
	}
</script>

<style>
	@import '@/common/uni.css';
	@import '@/common/uni-icons.css';
</style>
